import { reqLoginPWD, reqLoginPhone } from '@/api'
// 小仓库
const state = {
  loginShowNum: 1,
  istrue: 0
}
const mutations = {
  CHANGELOGINSHOWNUM(state, showNum) {
    state.loginShowNum = showNum
  },
  LOGINPHONE(state, istrue) {
    state.istrue = istrue
  }
}
const actions = {
  changeLoginShowNum({ commit }, showNum) {
    commit('CHANGELOGINSHOWNUM', showNum)
  },
  async loginpwd({ commit }, { phone, password }) {
    const data = { phone, password }
    let result = await reqLoginPWD(data)
    if (result.status == 1 || result.status == 0) {
      commit('LOGINPHONE', result.status)
    }
    // console.log(result);
  },
  async loginPhone({ commit }, phone) {
    let result = await reqLoginPhone(phone)
    if (result.status == 1 || result.status == 0) {
      commit('LOGINPHONE', result.status)
    }
    // console.log(result);
  }
}
const getters = {}
export default {
  state,
  mutations,
  actions,
  getters
}